#pragma  once
#include "public.h"
#include <string.h>
#include "IOCTLSerializer.h"
#include "URBSerializer.h"
#include "MyBuffer.h"
#include <wdm.h>

typedef struct _USBFILTER_DEVICE_EXTENSION
{
	PDEVICE_OBJECT AttachedToDeviceObject;
	IO_REMOVE_LOCK RemoveLock;
	BOOLEAN isWathDevice;
} USBFILTER_DEVICE_EXTENSION, *PUSBFILTER_DEVICE_EXTENSION;


#define arraysize(p) (sizeof(p)/sizeof((p)[0]))
#define MAX_HARDWARE_NAME_LEN 400

NTSTATUS		US_AddDevice(IN PDRIVER_OBJECT, IN PDEVICE_OBJECT);
VOID			US_Unload(PDRIVER_OBJECT);

BOOLEAN			US_PassPacketToUserMode(PIRP, BOOLEAN);

NTSTATUS 		US_DispatchIOCTL(IN PDEVICE_OBJECT fido, IN PIRP pIrp);
NTSTATUS		US_CompletionRoutine(IN PDEVICE_OBJECT fido, IN PIRP pIrp, IN PVOID context);

NTSTATUS		US_DispatchPnp(IN PDEVICE_OBJECT, IN PIRP);
NTSTATUS		US_DispatchPower(IN PDEVICE_OBJECT,IN PIRP);
NTSTATUS		US_DispatchAny(IN PDEVICE_OBJECT, IN PIRP);
NTSTATUS		US_DispatchCreate(IN PDEVICE_OBJECT, IN PIRP);
NTSTATUS		US_DispatchClose(IN PDEVICE_OBJECT, IN PIRP);

VOID			US_RemoveDevice(IN PDEVICE_OBJECT);
PDEVICE_OBJECT	US_FindAttachDevInDrList(WCHAR* hardwareName, PDRIVER_OBJECT driverObject);
NTSTATUS		US_CompleteRequest(IN PIRP, IN NTSTATUS, IN ULONG_PTR);
NTSTATUS		US_StartDeviceCompletionRoutine(PDEVICE_OBJECT, PIRP, PUSBFILTER_DEVICE_EXTENSION);
NTSTATUS		US_UsageNotificationCompletionRoutine(PDEVICE_OBJECT, PIRP, PUSBFILTER_DEVICE_EXTENSION);
